import { createApp } from 'vue'
// import './style.css'
/* 导入element-plus相关组件及css */
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
/* 导入图标 */
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
/* 导入语言包 */
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'


/* 导入路由 */
import router from './router/router.js'

import App from './App.vue'
/* 导入自己的组件 */
// import LoginView from "./view/LoginView.vue";

/* 注册图标 */
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}


// 判断用户偏好或浏览器的默认语言选择语言包
const locale = navigator.language.includes('zh') ? zhCn : en;

/*
    使用use方法来应用element-plus
    注意：mount（挂载）是最后一步，所以use要在它前面
 */
app.use(ElementPlus,{
    locale
}).use(router).mount('#app')
